<!--
    Document   : profiel van een bedrijf met pakket c
    Created on : 18-mei-2011, 08:45:23
    Author     : Shahram abdi
-->
<div id="content">
    <h3><a href="../index.php?p=home">Geoplaza</a><a href="index.php?p=home"> &rsaquo;&rsaquo; werkgever</a> &rsaquo;&rsaquo; Mijn profiel</h3>
    <div id="Profilehead">Profiel</div>

    <div id="profile">
        <?php
        require_once('../config/appvars.php');
        require_once('../config/config.php');

        // Make sure the user is logged in before going any further.
        if (!isset($_SESSION['user_id'])) {
            echo '<p>Please <a href="../index.php?p=home">log in</a> to access this page.</p>';
            exit();
        }

        // Connect to the database
        $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);

        // Grab the profile data from the database
        if (!isset($_GET['user_id'])) {
            $query = "SELECT instellingnaam, relatienummer, adres, postcode, woonplaats, provencie, telefoon, email, logo, film FROM werkgeverprofiel WHERE werkgeverID = '" . $_SESSION['user_id'] . "'";
        } else {
            $query = "SELECT instellingnaam, relatienummer, adres, postcode, woonplaats, provencie, telefoon, email, logo, film FROM werkgeverprofiel WHERE werkgeverID = '" . $_GET['user_id'] . "'";
        }
        $data = mysqli_query($dbc, $query);

        if (mysqli_num_rows($data) == 1) {
            // The user row was found so display the user data
            $row = mysqli_fetch_array($data);

            $querystage = "SELECT stagetitel, stagetype, stageniveau, stageperiode, stagevergoeding, stagedatum , omschrijving FROM stages WHERE relatienummer = '" . $row['relatienummer'] . "'";
            $datastage = mysqli_query($dbc, $querystage);

            $queryvacatures = "SELECT vacaturetitel, vacaturplaats, vacatureniveau, uren, vomschrijving FROM vacatures WHERE relatienummer = '" . $row['relatienummer'] . "'";
            $datavacatures = mysqli_query($dbc, $queryvacatures);

            $querymedewerkers = "SELECT medewerkernaam, medewerkerspecialist FROM medewerkers  WHERE relatienummer = '" . $row['relatienummer'] . "'";
            $datamedewerkers = mysqli_query($dbc, $querymedewerkers);

            if (!empty($row['logo'])) {
                echo '<img class="profile" src="' . MM_UPLOADPATH . $row['logo'] . '" alt="logo Picture" />';
            }

            if (!empty($row['instellingnaam'])) {
                echo '<div id="Profilecontent"><b>' . $row['instellingnaam'] . '</b></div>';
            }
            echo '<fieldset class="info">';
            echo '<p class="insidetitel">Bedrijfsinformatie</p>';
            echo '<p class="titel">Instellingnaam:</p><p class="in">' . $row['instellingnaam'] . '</p>';
            echo '<p class="titel">Adres:</p><p class="in">' . $row['adres'] . '</p>';
            echo '<p class="titel">&nbsp; </p><p class="in">' . $row['postcode'] . '   ' . $row['woonplaats'] . '</p>';
            echo '<p class="titel">Provencie:</p><p class="in">' . $row['provencie'] . '</p>';
            echo '<p class="titel">Telefoon:</p><p class="in">0' . $row['telefoon'] . '</p>';
            echo '<p class="titel">Email:</p><p class="in">' . $row['email'] . '</p>';
            echo '<p class="insidetitel">Bedrijfspresentatie:</p>';

            if (!empty($row['film'])) {
                echo '<div id="viewfilm"> <OBJECT ID="MediaPlayer" WIDTH="245" HEIGHT="200" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
            STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">
            <PARAM NAME="FileName" VALUE="' . MM_UPLOADPATH . $row['film'] . '">
            <PARAM name="autostart" VALUE="false">
            <PARAM name="ShowControls" VALUE="true">
            <param name="ShowStatusBar" value="false">
            <PARAM name="ShowDisplay" VALUE="false">
            <EMBED TYPE="application/x-mplayer2" SRC="' . MM_UPLOADPATH . $row['film'] . '" NAME="MediaPlayer"
            WIDTH="290" HEIGHT="290" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="0"> </EMBED>
            </OBJECT></div>';
            }
            while ($rowstage = mysqli_fetch_array($datastage)) {
                echo '<p class="insidetitel">Stage gegevens</p>';
                echo '<p class="titel">Stagetitel:</p><p class="in">' . $rowstage['stagetitel'] . '</p>';
                echo '<p class="titel">Stagetype:</p><p class="in">' . $rowstage['stagetype'] . '</p>';
                echo '<p class="titel">Niveau:</p><p class="in">' . $rowstage['stageniveau'] . '</p>';
                echo '<p class="titel">Stageperiode:</p><p class="in">' . $rowstage['stageperiode'] . '</p>';
                echo '<p class="titel">Stagevergoeding:</p><p class="in">' . $rowstage['stagevergoeding'] . '</p>';
                echo '<p class="titel">Stagedatum:</p><p class="in">' . $rowstage['stagedatum'] . '</p>';
                echo '<p class="titel">Omschrijving:</p>';
                echo '<p class="omin">' . $rowstage['omschrijving'] . '</p>';
            }
            while ($rowvacatures = mysqli_fetch_array($datavacatures)) {
                echo '<p class="insidetitel">Vacature gegevens</p>';
                echo '<p class="titel">Vacature:</p><p class="in">' . $rowvacatures['vacaturetitel'] . '</p>';
                echo '<p class="titel">Plaats:</p><p class="in">' . $rowvacatures['vacaturplaats'] . '</p>';
                echo '<p class="titel">Niveau:</p><p class="in">' . $rowvacatures['vacatureniveau'] . '</p>';
                echo '<p class="titel">Uren:</p><p class="in">' . $rowvacatures['uren'] . '</p>';
                echo '<p class="titel">Omschrijving:</p>';
                echo '<p class="omin">' . $rowvacatures['vomschrijving'] . '</p>';
            }
            while ($rowmedewerkers = mysqli_fetch_array($datamedewerkers)) {
                echo '<p class="insidetitel">Medewerker gegevens</p>';
                echo '<p class="titel">Medewerker naam:</p><p class="in">' . $rowmedewerkers['medewerkernaam'] . '</p>';
                echo '<p class="titel">Specialist:</p><p class="in">' . $rowmedewerkers['medewerkerspecialist'] . '</p>';
            }

            echo '</fieldset>';
        } // End of check for a single row of user results
        else {
            echo '<p class="error">There was a problem accessing your profile.</p>';
        }
        mysqli_close($dbc);
        ?>

    </div>
</div>